/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2025. All rights reserved.
 */

import { TaskDetails } from '@ohos/hvigor';
import { HvigorTaskGroupType } from '@ohos/hvigor/src/base/external/task/core-task.js';

/**
 * plugin任务类型
 */
export enum TaskGroupType {
  ARKTS_TASK_GROUP = 'ArkTS',
  JS_TASK_GROUP = 'JS',
  RESOURCES_TASK_GROUP = 'Resources',
  PACKAGE_TASK_GROUP = 'Package',
  SIGN_TASK_GROUP = 'Sign',
  VERIFICATION_TASK_GROUP = 'Verification',
  GENERATE_TASK_GROUP = 'Generate',
  HOOK_TASK_GROUP = 'Hook',
  CONFIG_TASK_GROUP = 'Config',
  NATIVE_TASK_GROUP = 'Native',
}

/**
 * 注册的Hvigor-ohos-plugin任务名的统一管理类
 *
 * @since 2022/9/7
 */
export namespace TaskNames {
  const legacyFATaskPrefix = 'Legacy';
  const stageTaskPrefix = '';

  export class LegacyFATask {
    static readonly COMPILE_ARK: TaskDetails = {
      name: `${legacyFATaskPrefix}Compile`,
      description: 'Compile ArkTS components for large-system devices in the FA model.',
      group: TaskGroupType.ARKTS_TASK_GROUP,
    };

    static readonly PROCESS_RESOURCE: TaskDetails = {
      name: `${legacyFATaskPrefix}ProcessResource`,
      description: 'Process resources in the FA model.',
      group: TaskGroupType.RESOURCES_TASK_GROUP,
    };

    static readonly PREVIEW_PROCESS_RESOURCE: TaskDetails = {
      name: `${legacyFATaskPrefix}PreviewProcessResource`,
      description: 'Process preview resources incrementally in the FA model.',
      group: TaskGroupType.RESOURCES_TASK_GROUP,
    };

    static readonly PRE_BUILD: TaskDetails = {
      name: `${legacyFATaskPrefix}PreBuild`,
      description: 'Pre-build in the FA model.',
      group: TaskGroupType.VERIFICATION_TASK_GROUP,
    };

    static readonly SYSCAP_TRANSFORM: TaskDetails = {
      name: `${legacyFATaskPrefix}SyscapTransform`,
      description: 'Transform SysCap in the FA model.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };

    static readonly GENERATE_METADATA: TaskDetails = {
      name: `${legacyFATaskPrefix}GenerateMetadata`,
      description: 'Generate metadata in the FA model.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };

    static readonly COMPILE_LITE_NODE: TaskDetails = {
      name: `${legacyFATaskPrefix}CompileLite`,
      description: 'Compile ArkTS or JS components using Node.js for mini-, small- and standard-system devices in the FA model.',
      group: TaskGroupType.ARKTS_TASK_GROUP,
    };

    static readonly COMPILE_NODE: TaskDetails = {
      name: `${legacyFATaskPrefix}Build`,
      description: 'Compile ArkTS or JS components using Node.js for large-system devices in the FA model.',
      group: TaskGroupType.ARKTS_TASK_GROUP,
    };

    static readonly OHOS_TEST_ARK_COMPILE: TaskDetails = {
      name: `${legacyFATaskPrefix}OhosTestCompile`,
      description: 'Compile ArkTS or JS components using Node.js for large-system devices in the FA model.',
      group: TaskGroupType.ARKTS_TASK_GROUP,
    };

    static readonly OHOS_TEST_COMPILE_NODE: TaskDetails = {
      name: `${legacyFATaskPrefix}OhosTestBuild`,
      description: 'Compile ArkTS or JS components using Node.js for large-system devices in the FA model.',
      group: TaskGroupType.ARKTS_TASK_GROUP,
    };

    static readonly MERGE_NODE_ASSETS: TaskDetails = {
      name: `${legacyFATaskPrefix}ProcessNodeAssets`,
      description: 'Merge all ArkTS and JS assets into a directory before package in the FA model.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };

    static readonly GENERATE_LITE_CODE: TaskDetails = {
      name: `${legacyFATaskPrefix}GenerateLiteCode`,
      description: 'Generate project code for mini-, small- and standard-system devices in the FA model.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };
    static readonly SIGN_LITE_BIN: TaskDetails = {
      name: `${legacyFATaskPrefix}SignLiteBin`,
      description: 'Sign BIN files for mini-, small- and standard-system devices in the FA model.',
      group: TaskGroupType.SIGN_TASK_GROUP,
    };
    static readonly COMPILE_RESOURCE: TaskDetails = {
      name: `${legacyFATaskPrefix}CompileResource`,
      description: 'Compile project resources in the FA model.',
      group: TaskGroupType.RESOURCES_TASK_GROUP,
    };
    static readonly PREVIEW_COMPILE_RESOURCE: TaskDetails = {
      name: `${legacyFATaskPrefix}PreviewCompileResource`,
      description: 'Use Preview to compile project resources in the FA model.',
      group: TaskGroupType.RESOURCES_TASK_GROUP,
    };
    static readonly GENERATE_HAR_JS_MANIFEST: TaskDetails = {
      name: `${legacyFATaskPrefix}GenerateHarJsManifest`,
      description: 'Generate a fake JS manifest in the FA model.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };
    static readonly GENERATE_JS_MANIFEST: TaskDetails = {
      name: `${legacyFATaskPrefix}GenerateJsManifest`,
      description: 'Generate JsManifest.json in the FA model.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };
    static readonly MAKE_PACK_INFO: TaskDetails = {
      name: `${legacyFATaskPrefix}MakePackInfo`,
      description: 'Generate module pack.info.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };
    static readonly MERGE_PROFILE: TaskDetails = {
      name: `${legacyFATaskPrefix}MergeProfile`,
      description: 'Merge app config manifest files in the FA model.',
      group: TaskGroupType.CONFIG_TASK_GROUP,
    };
    static readonly PACKAGE_HAP: TaskDetails = {
      name: `${legacyFATaskPrefix}PackageHap`,
      description: 'Build the HAP package in the FA model.',
      group: TaskGroupType.PACKAGE_TASK_GROUP,
    };
    static readonly GENERATE_LOADER_JSON: TaskDetails = {
      name: `${legacyFATaskPrefix}GenerateLoaderJson`,
      description: 'Generate a loader.json file in the FA model.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };
    static readonly GENERATE_HAR_LOADER_JSON: TaskDetails = {
      name: `${legacyFATaskPrefix}GenerateHarLoaderJson`,
      description: 'Generate a loader.json file for the HAR package in the FA model.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };
    static readonly PROCESS_PROFILE: TaskDetails = {
      name: `${legacyFATaskPrefix}ProcessProfile`,
      description: 'Process the app manifest configuration file in the FA model.',
      group: TaskGroupType.CONFIG_TASK_GROUP,
    };

    static readonly PROCESS_HAR_ARTIFACTS: TaskDetails = {
      name: `${legacyFATaskPrefix}ProcessHarArtifacts`,
      description: 'collect the HAR build artifacts in the FA model.',
      group: TaskGroupType.PACKAGE_TASK_GROUP,
    };

    static readonly PACKAGE_HAR: TaskDetails = {
      name: `${legacyFATaskPrefix}PackageHar`,
      description: 'Build the legacy HAR package in the FA model.',
      group: TaskGroupType.PACKAGE_TASK_GROUP,
    };

    static readonly PROCESS_OH_PACKAGE_JSON: TaskDetails = {
      name: `${legacyFATaskPrefix}ProcessOHPackageJson`,
      description: 'Process HAR oh-package.json5 in the FA model.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };
  }

  export class Task {
    static readonly PREVIEW_UPDATE_ASSETS: TaskDetails = {
      name: `${stageTaskPrefix}PreviewUpdateAssets`,
      description: 'Update main_pages.json and module.json before PreviewBuild.',
      group: TaskGroupType.CONFIG_TASK_GROUP,
    };

    static readonly COMPILE_ARK: TaskDetails = {
      name: `${stageTaskPrefix}Compile`,
      description: 'Compile ArkTS or JS components for large-system devices in the stage model.',
      group: TaskGroupType.ARKTS_TASK_GROUP,
    };

    static readonly PREVIEW_BUILD: TaskDetails = {
      name: `${stageTaskPrefix}PreviewBuild`,
      description: 'Build preview in the stage model.',
      group: TaskGroupType.HOOK_TASK_GROUP,
    };

    static readonly HOT_RELOAD_BUILD: TaskDetails = {
      name: `${stageTaskPrefix}HotReloadBuild`,
      description: 'Build in hot reload mode.',
      group: TaskGroupType.HOOK_TASK_GROUP,
    };

    static readonly UNIT_TEST_BUILD: TaskDetails = {
      name: `${stageTaskPrefix}UnitTestBuild`,
      description: 'Build a unit test.',
      group: TaskGroupType.HOOK_TASK_GROUP,
    };

    static readonly TEST: TaskDetails = {
      name: `${stageTaskPrefix}test`,
      description: 'Build a unit test without DevEco Studio',
      group: TaskGroupType.HOOK_TASK_GROUP,
    };

    static readonly ON_DEVICE_TEST: TaskDetails = {
      name: `${stageTaskPrefix}onDeviceTest`,
      description: 'Build a device test without DevEco Studio',
      group: TaskGroupType.HOOK_TASK_GROUP,
    };

    static readonly GENERATE_UNIT_TEST_TEMPLATE: TaskDetails = {
      name: `${stageTaskPrefix}GenerateUnitTestTemplate`,
      description: 'Building a unit test template without DevEco Studio',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };

    static readonly GENERATE_OHOS_TEST_TEMPLATE: TaskDetails = {
      name: `${stageTaskPrefix}GenerateOhosTestTemplate`,
      description: 'Building a ohosTest template without DevEco Studio',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };

    static readonly GENERATE_UNIT_TEST_RESULT: TaskDetails = {
      name: `${stageTaskPrefix}GenerateUnitTestResult`,
      description: 'Building a unit test result without DevEco Studio',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };

    static readonly BUILD_UNIT_TEST_RES: TaskDetails = {
      name: `${stageTaskPrefix}BuildUnitTestHook`,
      description: 'Build a unit test hook.',
      group: TaskGroupType.HOOK_TASK_GROUP,
    };

    static readonly REPLACE_SOURCEMAP_IN_COVERAGE_MODE: TaskDetails = {
      name: `${stageTaskPrefix}ReplaceSourceMapInCoverageMode`,
      description: 'Replace sourcemap in coverage mode.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };

    static readonly PROCESS_RESOURCE: TaskDetails = {
      name: `${stageTaskPrefix}ProcessResource`,
      description: 'Process resources in the stage model.',
      group: TaskGroupType.RESOURCES_TASK_GROUP,
    };

    static readonly PREVIEW_PROCESS_RESOURCE: TaskDetails = {
      name: `${stageTaskPrefix}PreviewProcessResource`,
      description: 'Process preview resources incrementally in the stage model.',
      group: TaskGroupType.RESOURCES_TASK_GROUP,
    };

    static readonly PRE_BUILD: TaskDetails = {
      name: `${stageTaskPrefix}PreBuild`,
      description: 'Pre-build in the stage model.',
      group: TaskGroupType.VERIFICATION_TASK_GROUP,
    };

    static readonly COMPILE_NODE: TaskDetails = {
      name: `${stageTaskPrefix}Build`,
      description: 'Compile ArkTS or JS components using Node.js for large-system devices in the stage model.',
      group: TaskGroupType.ARKTS_TASK_GROUP,
    };

    static readonly OHOS_TEST_COMPILE_NODE: TaskDetails = {
      name: `${stageTaskPrefix}OhosTestBuild`,
      description: 'Compile ArkTS or JS components using Node.js for large-system devices in the stage model.',
      group: TaskGroupType.ARKTS_TASK_GROUP,
    };

    static readonly OHOS_TEST_ARK_COMPILE: TaskDetails = {
      name: `${stageTaskPrefix}OhosTestCompile`,
      description: 'Compile ArkTS or JS components using Node.js for large-system devices in the stage model.',
      group: TaskGroupType.ARKTS_TASK_GROUP,
    };

    static readonly COMPILE_RESOURCE: TaskDetails = {
      name: `${stageTaskPrefix}CompileResource`,
      description: 'Compile project resources in the stage model.',
      group: TaskGroupType.RESOURCES_TASK_GROUP,
    };
    static readonly PREVIEW_COMPILE_RESOURCE: TaskDetails = {
      name: `${stageTaskPrefix}PreviewCompileResource`,
      description: 'Use Preview to compile project resources in the stage model.',
      group: TaskGroupType.RESOURCES_TASK_GROUP,
    };
    static readonly MAKE_PACK_INFO: TaskDetails = {
      name: `${stageTaskPrefix}MakePackInfo`,
      description: 'Generate module pack.info in the stage model.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };
    static readonly MAKE_PROJECT_PACK_INFO: TaskDetails = {
      name: `${stageTaskPrefix}MakeProjectPackInfo`,
      description: 'Generate project pack.info in the stage model.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };
    static readonly PROCESS_PROJECT_PRIVACY_PROFILE: TaskDetails = {
      name: `${stageTaskPrefix}ProcessProjectPrivacyProfile`,
      description: 'Process project pac.json5 in the stage model.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };
    static readonly MERGE_PROFILE: TaskDetails = {
      name: `${stageTaskPrefix}MergeProfile`,
      description: 'Merge app config manifest files in the stage model.',
      group: TaskGroupType.CONFIG_TASK_GROUP,
    };
    static readonly BUILD_NATIVE_WITH_CMAKE: TaskDetails = {
      name: `${stageTaskPrefix}BuildNativeWithCmake`,
      description: 'Compile CPP source with CMake in the stage model.',
      group: TaskGroupType.NATIVE_TASK_GROUP,
    };
    static readonly PACKAGE_HAP: TaskDetails = {
      name: `${stageTaskPrefix}PackageHap`,
      description: 'Build the HAP package in the stage model.',
      group: TaskGroupType.PACKAGE_TASK_GROUP,
    };
    static readonly FAST_PACKAGE: TaskDetails = {
      name: `${stageTaskPrefix}FastPackageHap`,
      description: 'Fast build the HAP package in the stage model.',
      group: TaskGroupType.PACKAGE_TASK_GROUP,
    };
    static readonly PACKAGE_HSP: TaskDetails = {
      name: `${stageTaskPrefix}PackageHsp`,
      description: 'Build the HSP package in the stage model.',
      group: TaskGroupType.PACKAGE_TASK_GROUP,
    };
    static readonly FAST_PACKAGE_HSP: TaskDetails = {
      name: `${stageTaskPrefix}FastPackageHsp`,
      description: 'Fast Build the HSP package in the stage model.',
      group: TaskGroupType.PACKAGE_TASK_GROUP,
    };
    static readonly GENERATE_PKG_MODULE_JSON: TaskDetails = {
      name: `${stageTaskPrefix}GeneratePkgModuleJson`,
      description: 'Generate the module.json in the stage model.',
      group: TaskGroupType.PACKAGE_TASK_GROUP,
    };
    static readonly PROCESS_PROFILE: TaskDetails = {
      name: `${stageTaskPrefix}ProcessProfile`,
      description: 'Process app config manifest files in the stage model.',
      group: TaskGroupType.CONFIG_TASK_GROUP,
    };
    static readonly GeneratePackRes: TaskDetails = {
      name: `${stageTaskPrefix}GeneratePackRes`,
      description: 'Build the pack.res file in the stage model.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };
    static readonly PACKAGE_APP: TaskDetails = {
      name: `${stageTaskPrefix}PackageApp`,
      description: 'Build the app package in the stage model.',
      group: TaskGroupType.PACKAGE_TASK_GROUP,
    };
    static readonly BUILD_NATIVE_WITH_NINJA: TaskDetails = {
      name: `${stageTaskPrefix}BuildNativeWithNinja`,
      description: 'Compile CPP source with Ninja in the stage model.',
      group: TaskGroupType.NATIVE_TASK_GROUP,
    };
    static readonly GENERATE_LOADER_JSON: TaskDetails = {
      name: `${stageTaskPrefix}GenerateLoaderJson`,
      description: 'Generate loader.json in the stage model.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };
    static readonly MERGE_RESOURCE: TaskDetails = {
      name: `${stageTaskPrefix}MergeResource`,
      description: 'Merge resources in the stage model.',
      group: TaskGroupType.RESOURCES_TASK_GROUP,
    };

    static readonly PACKAGE_HAR: TaskDetails = {
      name: `${stageTaskPrefix}PackageHar`,
      description: 'Build the HAR package in the stage model.',
      group: TaskGroupType.PACKAGE_TASK_GROUP,
    };

    static readonly PROCESS_HAR_ARTIFACTS: TaskDetails = {
      name: `${stageTaskPrefix}ProcessHarArtifacts`,
      description: 'process the HAR build artifacts in the stage model.',
      group: TaskGroupType.PACKAGE_TASK_GROUP,
    };

    static readonly PROCESS_PACKAGE_JSON: TaskDetails = {
      name: `${stageTaskPrefix}ProcessPackageJson`,
      description: 'Process HAR package.json in the stage model.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };

    static readonly PROCESS_OH_PACKAGE_JSON: TaskDetails = {
      name: `${stageTaskPrefix}ProcessOHPackageJson`,
      description: 'Process HAR package.json in the stage model.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };

    static readonly PROCESS_LIB: TaskDetails = {
      name: `${stageTaskPrefix}ProcessLibs`,
      description: 'Process .so files in the stage model.',
      group: TaskGroupType.RESOURCES_TASK_GROUP,
    };

    static readonly DO_NATIVE_STRIP: TaskDetails = {
      name: `${stageTaskPrefix}DoNativeStrip`,
      description: 'Strip .so files to decrease size.',
      group: TaskGroupType.NATIVE_TASK_GROUP,
    };

    static readonly CACHE_NATIVE_LIBS: TaskDetails = {
      name: `${stageTaskPrefix}CacheNativeLibs`,
      description: 'cache native strip .so fileInfo',
      group: TaskGroupType.NATIVE_TASK_GROUP,
    };

    static readonly CONFIGURE_CMAKE: TaskDetails = {
      name: `${stageTaskPrefix}ConfigureCmake`,
      description: 'cache native strip .so fileInfo',
      group: TaskGroupType.NATIVE_TASK_GROUP,
    };

    static readonly SYSCAP_TRANSFORM: TaskDetails = {
      name: `${stageTaskPrefix}SyscapTransform`,
      description: 'Transform SysCap in the stage model.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };

    static PACKAGE_SHARED_HAR: TaskDetails = {
      name: `${stageTaskPrefix}PackageSharedHar`,
      description: 'Build the shared HAR package in the stage model.',
      group: TaskGroupType.PACKAGE_TASK_GROUP,
    };

    static PREPARE_SHARED_HAR_RES: TaskDetails = {
      name: `${stageTaskPrefix}PrepareSharedHarResource`,
      description: 'Prepare resources for the shared HAR package in the stage model.',
      group: TaskGroupType.CONFIG_TASK_GROUP,
    };

    static PACKAGE_SHARED_TGZ: TaskDetails = {
      name: `${stageTaskPrefix}PackageSharedTgz`,
      description: 'Build the shared HAR and HSP files into a TGZ package in the stage model.',
      group: TaskGroupType.PACKAGE_TASK_GROUP,
    };

    static GENERATE_METADATA: TaskDetails = {
      name: `${stageTaskPrefix}GenerateMetadata`,
      description: 'Generate metadata in the stage model.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };

    static readonly PREVIEW: TaskDetails = {
      name: 'Preview',
      description: 'Compile ArkTS components on preview in the stage model.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };

    static readonly UNIT_TEST: TaskDetails = {
      name: 'UnitTest',
      description: 'Compile ArkTS components at unit test time in the stage model.',
      group: TaskGroupType.ARKTS_TASK_GROUP,
    };

    static readonly HOT_RELOAD: TaskDetails = {
      name: 'HotReload',
      description: 'Compile ArkTS components during hot loading in the stage model.',
      group: TaskGroupType.ARKTS_TASK_GROUP,
    };

    static readonly COLD_RELOAD: TaskDetails = {
      name: 'ColdReload',
      description: 'Compile ArkTS components during cold loading in the stage model.',
      group: TaskGroupType.ARKTS_TASK_GROUP,
    };

    static readonly HAR_COMPILE: TaskDetails = {
      name: 'HarCompile',
      description: 'Compile ArkTS components for packaged HAR files in the stage model.',
      group: TaskGroupType.ARKTS_TASK_GROUP,
    };

    static readonly HAR_BUILD: TaskDetails = {
      name: 'HarBuild',
      description: 'Build ArkTS components for packaged HAR files in the stage model.',
      group: TaskGroupType.ARKTS_TASK_GROUP,
    };

    static readonly OHOS_TEST_COPY_MOCK_CONFIG_JSON: TaskDetails = {
      name: 'OhosTestCopyMockConfigJson',
      description: 'Ohos test copy mock config json to hap resources.',
      group: HvigorTaskGroupType.OTHER_TASK_GROUP,
    };

    static readonly UNIT_TEST_COPY_MOCK_CONFIG_JSON: TaskDetails = {
      name: 'UnitTestCopyMockConfigJson',
      description: 'Unit test copy mock config json to hap resources.',
      group: HvigorTaskGroupType.OTHER_TASK_GROUP,
    };

    static readonly LINT: TaskDetails = {
      name: 'Lint',
      description: 'Lint ArkTS for HAR files.',
      group: TaskGroupType.ARKTS_TASK_GROUP,
    };

    static readonly PREPARE_QUICKFIX: TaskDetails = {
      name: 'PrepareQuickfix',
      description: 'Prepare changed assets for quickfix.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };

    static readonly PACKAGE_HQF: TaskDetails = {
      name: 'PackageHqf',
      description: 'Preform quickfix hqf packaging.',
      group: TaskGroupType.PACKAGE_TASK_GROUP,
    };

    static readonly SIGN_HQF: TaskDetails = {
      name: 'SignHqf',
      description: 'Signing for quickfix hqf package.',
      group: TaskGroupType.SIGN_TASK_GROUP,
    };

    static readonly PROCESS_ROUTER_MAP: TaskDetails = {
      name: 'ProcessRouterMap',
      description: 'Process router map configuration.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };

    static readonly PROCESS_STARTUP_CONFIG: TaskDetails = {
      name: 'ProcessStartupConfig',
      description: 'Process startup configuration.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };

    static readonly GENERATE_DEVICE_COVERAGE: TaskDetails = {
      name: 'GenerateDeviceCoverage',
      description: 'Generate ohos test coverage report.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };

    static readonly BEFORE_GENERATE_DEVICE_COVERAGE: TaskDetails = {
      name: 'BeforeGenerateDeviceCoverage',
      description: 'Generate ohos test coverage report prerequisites.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };

    static readonly GENERATE_PKG_CONTEXT_INFO: TaskDetails = {
      name: 'GeneratePkgContextInfo',
      description: 'Generate pkgContextInfo.json to ets-loader.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };

    static readonly COLLECT_DEBUG_SYMBOL: TaskDetails = {
      name: 'CollectDebugSymbol',
      description: 'Collect debug symbols to output dir.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };


    static readonly COMPILE_ARKTS_EVOLUTION: TaskDetails = {
      name: 'CompileArkTSEvolution',
      description: 'Compile ArkTS Evolution.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };

    static readonly OHOS_TEST_COMPILE_ARKTS_EVOLUTION: TaskDetails = {
      name: 'OhosTestCompileArkTSEvolution',
      description: 'Compile ArkTS Evolution.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };

    static readonly GENERATE_DECLARATION: TaskDetails = {
      name: 'GenerateDeclaration',
      description: 'Generate a declaration file',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };

    static readonly HAR_GENERATE_DECLARATION: TaskDetails = {
      name: 'HarGenerateDeclaration',
      description: 'Generate a declaration file',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };

    static readonly HAR_COMPILE_ARKTS_EVOLUTION: TaskDetails = {
      name: 'HarCompileArkTSEvolution',
      description: 'Compile ArkTS Evolution.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };
  }

  export class CommonTask {
    static readonly PRE_BUILD_APP: TaskDetails = {
      name: 'PreBuildApp',
      description: 'Prepare before building the app.',
      group: TaskGroupType.VERIFICATION_TASK_GROUP,
    };
    static readonly DUPLICATE_DEPENDENCY_CHECK: TaskDetails = {
      name: 'DuplicateDependencyCheck',
      description: 'Check duplicated dependencies when building app.',
      group: TaskGroupType.VERIFICATION_TASK_GROUP,
    };
    static readonly SIGN_HAP: TaskDetails = {
      name: 'SignHap',
      description: 'Sign the HAP package.',
      group: TaskGroupType.SIGN_TASK_GROUP,
    };
    static readonly SIGN_HSP: TaskDetails = {
      name: 'SignHsp',
      description: 'Sign the HAP package.',
      group: TaskGroupType.SIGN_TASK_GROUP,
    };
    static readonly PACKAGE_SIGN_HAR: TaskDetails = {
      name: 'PackageSignHar',
      description: 'Package and sign the HAR package.',
      group: TaskGroupType.SIGN_TASK_GROUP,
    };
    static readonly SIGN_MODULE_REMOTE_HSP: TaskDetails = {
      name: 'SignModuleRemoteHsp',
      description: 'Sign the module-level remote HSP package.',
      group: TaskGroupType.SIGN_TASK_GROUP,
    };
    static readonly PROCESS_INTEGRATED_HSP: TaskDetails = {
      name: 'ProcessIntegratedHsp',
      description: 'Use package tool process integrated hsp.',
      group: TaskGroupType.SIGN_TASK_GROUP,
    };
    static readonly SIGN_PROJECT_REMOTE_HSP: TaskDetails = {
      name: 'SignProjectRemoteHsp',
      description: 'Sign the project-level remote HSP package.',
      group: TaskGroupType.SIGN_TASK_GROUP,
    };
    static readonly SIGN_APP: TaskDetails = {
      name: 'SignApp',
      description: 'Sign the app package.',
      group: TaskGroupType.SIGN_TASK_GROUP,
    };
    static readonly VALIDATE_SIGNING: TaskDetails = {
      name: 'ValidateSigning',
      description: 'Verify the signature configuration.',
      group: TaskGroupType.VERIFICATION_TASK_GROUP,
    };
    static readonly CLEAN: TaskDetails = {
      name: 'clean',
      description: 'Clear the cache information.',
      group: HvigorTaskGroupType.OTHER_TASK_GROUP,
    };

    static readonly REPLACE_PREVIEWER_PAGES: TaskDetails = {
      name: 'ReplacePreviewerPage',
      description: 'Accept previewer arguments, then use them to replace the ones in the page file.',
      group: HvigorTaskGroupType.OTHER_TASK_GROUP,
    };

    static readonly COPY_PREVIEWER_PROFILE: TaskDetails = {
      name: 'CopyPreviewProfile',
      description: 'Copy preview profile.',
      group: HvigorTaskGroupType.OTHER_TASK_GROUP,
    };

    static readonly LEGACY_HOOK_COMPILE_RESOURCE: TaskDetails = {
      name: 'LegacyHookCompileResource',
      description: 'Add a hook task for compiling resources.',
      group: TaskGroupType.HOOK_TASK_GROUP,
    };

    static readonly PREVIEW_HOOK_COMPILE_RESOURCE: TaskDetails = {
      name: 'PreviewHookCompileResource',
      description: 'Add a hook task for compiling preview resources.',
      group: TaskGroupType.HOOK_TASK_GROUP,
    };

    static readonly PRE_CHECK_SYSCAP: TaskDetails = {
      name: 'PreCheckSyscap',
      description: 'Pre-check SysCap.',
      group: TaskGroupType.VERIFICATION_TASK_GROUP,
    };

    static readonly REPLACE_UNIT_TEST_INDEX_FILE: TaskDetails = {
      name: 'ReplaceUnitTestIndexFile',
      description: 'Replace the index file in unit tests.',
      group: HvigorTaskGroupType.OTHER_TASK_GROUP,
    };

    static readonly UNIT_TEST_PROCESS_PROFILE: TaskDetails = {
      name: 'UnitTestProcessProfile',
      description: 'Add the entry TestAbility to the profile file during unit test building.',
      group: TaskGroupType.CONFIG_TASK_GROUP,
    };

    static readonly CREATE_BUILD_PROFILE: TaskDetails = {
      name: 'CreateBuildProfile',
      description: 'Create the BuildProfile.ets file for the HAP/HSP package.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };
    static readonly CREATE_HAR_BUILD_PROFILE: TaskDetails = {
      name: 'CreateHarBuildProfile',
      description: 'Create the BuildProfile.ets file for the HAR package.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };
    static readonly CREATE_HAR_MODULE_INFO: TaskDetails = {
      name: 'CreateHarModuleInfo',
      description: 'Create the ModuleInfo.ts file for the byte code HAR package.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };
    static readonly CREATE_MODULE_INFO: TaskDetails = {
      name: 'CreateModuleInfo',
      description: 'Create the ModuleInfo.ts file for the hap/hsp package.',
      group: TaskGroupType.GENERATE_TASK_GROUP,
    };
    static readonly COLLECT_COVERAGE: TaskDetails = {
      name: 'collectCoverage',
      description: 'Generate coverage statistics reports based on instrumentation dotting data.',
      group: HvigorTaskGroupType.OTHER_TASK_GROUP,
      isEnabled: true,
    };
  }

  export class CommonHookTask {
    static readonly BUILD_PREVIEWER_RES: TaskDetails = {
      name: 'buildPreviewerResource',
      description: 'Build the preview resources.',
      group: TaskGroupType.HOOK_TASK_GROUP,
    };
    static readonly BUILD_HOT_RELOAD_RES: TaskDetails = {
      name: 'buildHotReloadResource',
      description: 'Build the hot reload resources.',
      group: TaskGroupType.HOOK_TASK_GROUP,
    };
    static readonly ASSEMBLE_APP: TaskDetails = {
      name: 'assembleApp',
      description: 'Assemble the task for the packaged app.',
      group: TaskGroupType.HOOK_TASK_GROUP,
    };
    static readonly ASSEMBLE_HAP: TaskDetails = {
      name: 'assembleHap',
      description: 'Assemble the task for the packaged HAP file.',
      group: TaskGroupType.HOOK_TASK_GROUP,
    };
    static readonly GEN_ON_DEVICE_TEST_HAP: TaskDetails = {
      name: 'genOnDeviceTestHap',
      description: 'Assemble the task for the packaged HAP file in HSP or HAR.',
      group: TaskGroupType.HOOK_TASK_GROUP,
    };
    static readonly ASSEMBLE_HSP: TaskDetails = {
      name: 'assembleHsp',
      description: 'Assemble the task for the packaged HSP file.',
      group: TaskGroupType.HOOK_TASK_GROUP,
    };
    static readonly ASSEMBLE_HAR: TaskDetails = {
      name: 'assembleHar',
      description: 'Assemble the task for the packaged HAR file.',
      group: TaskGroupType.HOOK_TASK_GROUP,
    };
    static readonly ASSEMBLE_HQF: TaskDetails = {
      name: 'assembleDevHqf',
      description: 'Assemble the task for the packaged HQF file.',
      group: TaskGroupType.HOOK_TASK_GROUP,
    };
    static readonly COMPILE_NATIVE: TaskDetails = {
      name: 'compileNative',
      description: 'Compile the hook task for native resources.',
      group: TaskGroupType.HOOK_TASK_GROUP,
    };
    static readonly GENERATE_BUILD_PROFILE: TaskDetails = {
      name: 'GenerateBuildProfile',
      description: 'Create build profile hook task.',
      group: TaskGroupType.HOOK_TASK_GROUP,
    };
  }

  export class SyncTask {
    static syncTaskName(moduleName: string): string {
      return 'init';
    }
  }
}
